package com.glela.common.constant;

import java.text.DecimalFormat;

/**
 * 常量池
 * 
 * @author liujie
 */
public interface CommonConstants {
	String HTTP = "http://";

	String RTMP = "rtmp://";

	DecimalFormat df = new DecimalFormat("######0");

	DecimalFormat df2 = new DecimalFormat(".##");

	/** 格式化元，精确到分 */
	DecimalFormat FORMAT_YUAN = new DecimalFormat("0.00");

	String CITY_LEVEL = "city";

	String PROVICE_LEVEL = "province";

	String CONUTRY_LEVEL = "conutry";

	String FREIGTH_SETTMENT = "虚拟物品 运费清账";

	int HAS_CHILDREN = 1;

	//成功处理
	int SUCCESS_RES = 1;
	//失败处理
	int FAIL_RES = 0;

	int UPDATE_USER_LOCATED_NUM = 6;

	String CHN = "CHN";

	String SH = "CHN_30000_310000";

	String READ_MATERIAL = "readMaterial";

	int STATUS_OPEN = 1;

	String USER_ID = "userId";

	String TEMP = "temp";

	String ORDER_BY = "orderby";

	String START_TIME = "startTime";

	String SEARCH_KEY = "searchKey";

	int TYPE_ANDROID = 1;

	int TYPE_IOS = 2;

	int ORDER_WELFARE_FREIGHT = 990;

	int ORDER_FREIGHT = 0;

	String ORDER_OBJECT_PREFIX = "P";

	int CASH_COIN_RATE = 100;

	int	NORMAL_USER_LEVEL		= 0;
	/** 普通推荐人级别 */
	int	RECOMMEND_LEVEL			= 50;
	/** 会员推荐人级别 */
	int	TALENT_RECOMMEND_LEVEL	= 75;
	/** 会员最小级别 */
	int	MEMBER_MIN_LEVEL		= 100;
	/** 达人最小级别 */
	int	TALENT_MIN_LEVEL		= 200;
	/** 达人最大级别 */
	int	TALENT_MAX_LEVEL		= 599;
	/** 达人导师级别 */
	int	TALENT_TEACHER_LEVEL	= 600;
	/** 督导级别 */
	int	SUPERVISOR_LEVEL		= 800;
	/** 会员最大级别 */
	int	MEMBER_MAX_LEVEL		= 1000;

	int		REFUND_DAY				= 7;
	/** 首页轮播图缓存key前缀 */
	String	SERIALS_TITLE_INFO_NEW	= "homePageSerail";

	/** 微信小程序登录用户信息token缓存key */
	String WECHAT_MINI_PROGRAM = "miniProgram";

	String USER_JOURNAL_TYPE_ADD = "+";

	String USER_JOURNAL_TYPE_SUB = "-";

	String COMMISION_DESC_SHARE = "直卖分佣";

	String COMMISION_DESC_OPEN_STORE = "开店分佣";

	int TEACHER_SHARE_NORMAL_UP_PRICE = 100;

	long SYSTEM_MAX_TOTAL_AMOUNT = 9000000000L;
	//购物车每次查询最大行数，
	int SHOPPING_CART_PAGE_SIZE = 99;

	String	PHONE_CLIENT_IOS		= "ios";
	String	PHONE_CLIENT_ANDROID	= "android";
	String	PHONE_CLIENT_h5			= "h5";
	String	PHONE_CLIENT_WX			= "wx";

	//购物车中产品选中状态标志 1 选中 0 未选中
	int	SHOPPING_CART_PRODUCT_SELECTED		= 1;
	int	SHOPPING_CART_PRODUCT_NOTSELECTED	= 0;

	int	SHOPPING_CART_PRODUCT_SINGER_SELECTED	= 0;
	int	SHOPPING_CART_PRODUCT_ALL_SELECTED		= 1;

	//订单入队在队列中未开始处理
	int ORDER_QUEUES_STATUS_NODEAL = 0;
	//订单入队订单已经开始处理中，未处理完成
	int ORDER_QUEUES_STATUS_DEALING = 1;
	//订单已经处理完成
	int ORDER_QUEUES_STATUS_DEAL = 2;
	//预热商品查询时间
	int PRELIMITSALEQUERYDAYS = 2;
	//店主精选最多上架商品数量
	int STORE_GOODS_NUM_MAX = 50;

	int NEW_GG_SHOW_NUM = 3;

	int NEW_GG_ID = 2;

	int SHARE_SEARCH_LIST_TYPE = 2;//分享结果列表类型（搜索）

	int SHARE_CATEGORY_TYPE = 1;//分享结果列表类型（分类）
	String ADD = "add";
	String UPDATE = "update";
	String GYSTOREID = "GY_store_id";
	String SYS_WMS_PRODUCT_URL = "sys_WMS_Product_URL";

	int DS_ROLE_ID = 7;//导师角色id
	int DD_ROLE_ID = 11;//督导角色id

	int LIVE_KEY_VALID_TIME = 14400;//直播地址有消息

	int sendChatRoomInfoRate = 5000;//下发聊天室消息频率（毫秒）

	String liveRoomDefaultTips = "小铺倡导绿色直播，请遵守相关法律法规，任何传播违法、违规、低俗、暴力等不良信息将会封停账号。警察叔叔24小时巡查哦。";

	long RANKING_NUM = 1000000000000000l;

	long RANKING_MAX_TIME = 9999999999999l;

	String hongBaoList = "hongbao:hongBaoList:id:";
	String hongBaoConsumedList = "hongbao:hongBaoConsumedList:id:";
	String hongBaoConsumedMap = "hongbao:hongBaoConsumedMap:id:";
	String hongBaoConsumedUpdateList = "hongbao:hongBaoConsumedUpdateList";

	String tryGetHongBaoScript =
			"if redis.call('hexists', KEYS[3], KEYS[4]) ~= 0 then\n"
					+ "return nil\n"
					+ "else\n"
					+ "local hongBao = redis.call('rpop', KEYS[1]);\n"
					+ "if hongBao then\n"
					+ "local x = cjson.decode(hongBao);\n"
					+ "x['userId'] = KEYS[4];\n"
					+ "x['time'] = KEYS[6];\n"
					+ "local re = cjson.encode(x);\n"
					+ "redis.call('hset', KEYS[3], KEYS[4], KEYS[4]);\n"
					+ "redis.call('rpush', KEYS[2], re);\n"
					+ "redis.call('rpush', KEYS[5], re);\n"
					+ "return re;\n"
					+ "end\n"
					+ "end\n"
					+ "return nil";

	String liveShareSendRedPackage =
			"if redis.call('hexists', KEYS[1] ,KEYS[2]) ~= 0 then\n" +
					"return 0\n" +
					"else\n"+
					"redis.call('hset',KEYS[1] ,KEYS[2] ,KEYS[3]);\n"+
					"return 1;\n"+
					"end";

	//参数：1，直播间分享人idkey 记录拉人明细；2，点击直播间分享链接的用户id；3，分享人本次直播分享数累计的key；4，score偏移量；5，maxtime;6,当前时间戳
		//7，分享人拉到最后一个人的时间戳记录key；8，排行榜有序集合；9，分享人id；10，红包发放记录key
	//判断分享人的点击人中是否有该用户点击记录，有的话直接返回0，如果没有将分享人的推荐数+1,并将分享人数加上最后时间戳组合后的值设置到有序集合中
	//4.27修改为全局点击人中是否有该用户点击记录
	String liveUserShareSetScript =
			"if redis.call('hexists',KEYS[10],KEYS[2]) ~=0 then\n"
			+"return 0;\n"
			+"else\n"
					+"redis.call('incr',KEYS[3]);\n"
					+"redis.call('sadd',KEYS[1] ,KEYS[2]);\n"
					+"redis.call('hset',KEYS[10] ,KEYS[2] ,KEYS[9]);\n"
					+"local count = redis.call('get',KEYS[3])*KEYS[4]+KEYS[5]-KEYS[6];\n"
					+"redis.call('zadd',KEYS[8],count,KEYS[9]);\n"
					+"redis.call('set',KEYS[7],KEYS[6]);\n"
					+"return 1;\n"
			+"end";
}
